package com.life.wd.service.Imp;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.life.wd.dto.OrderDTO;
import com.life.wd.exception.BusinessException;
import com.life.wd.mapper.OrderMapper;
import com.life.wd.result.PageResult;
import com.life.wd.service.OrderService;
import com.life.wd.vo.OrderVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImp implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public PageResult pageQuery(OrderDTO orderDTO) {
        PageHelper.startPage(orderDTO.getPage(),orderDTO.getPageSize());
        Page<OrderVO> orders = orderMapper.pageQuery(orderDTO);
        return new PageResult(orders.getTotal(),orders.getResult());
    }

    @Override
    public int update(Long id) {
        return orderMapper.update(id);
    }
}
